function cleanup()
{
global $_GET;
$ASPSOLVER = $_GET["solver"];
$lp1file = $_GET["lp1"];
$lp2file = $_GET["lp2"];
$lp3file = $_GET["lp3"];
if (substr($lpfile, 0, 5) == "_user")
{
$path = dirname($_SERVER['SCRIPT_FILENAME'])."/";
if (is_file($path.$lp1file))
unlink($path.$lp1file);
if (is_file($path.$lp2file))
unlink($path.$lp2file);
if (is_file($path.$lp3file))
unlink($path.$lp3file);
}
}
register_shutdown_function('cleanup');
if (!isset($_GET['lp1']))
fatal_error("No background knowledge specified! (lp1 not set in url)");
if (!isset($_GET['lp2']))
fatal_error("No domain description specified! (lp2 not set in url)");
if (!isset($_GET['lp3']))
fatal_error("No problem descritpion specified! (lp3 not set in url)");
echo "Running Program...
";
echo "Answer Sets:
";
exec($_GET['solver']." ".$_GET['lp1']." ".$_GET['lp2']." ".$_GET['lp3']." ".$_GET['opt']." | sed -e '1,$g/^$/d'", $output);
unset($output[0]);
echo "\n";
foreach ($output as $line)
{
if (!empty($line))
echo htmlspecialchars($line);
echo "\n";
}
echo "
\n";
?>